export default {
  namespaced: true,
  state: {
    data: JSON.parse(localStorage.getItem('admin')) || '',
    token: JSON.parse(localStorage.getItem('token')) || '',
  },
  mutations: {
    setadmin(state, playod) {
      state.data = playod.data
      localStorage.setItem('admin', JSON.stringify(playod.data))
    },
    settoken(state, playod) {
      state.token = playod.token
      localStorage.setItem('token', JSON.stringify(playod.token))
    },
    clear(state) {
      state.data = ''
      state.token = ''
    },
  },
  actions: {
    getdata(context, playod) {
      context.commit('setadmin', playod)
      context.commit('settoken', playod)
    },
  },
}
